package fr.umlv.m2.jee.pmlv.persistence.subject;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;


/**
 * Represents a keyword of a {@link Subject}.
 * @author jenseric
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name="KeyWord")
public class KeyWord implements Serializable {

	/**The id of the keyword*/
	@Id
	@GeneratedValue
	@Column(name="keyWord_id")
	private long id;
	/**The word which represented the keyword.*/
	
	@Column(name="keyWord_word")
	private String word;
	
	/**
	 * List of subjects where the Keyword is.
	 */
	@ManyToMany (mappedBy="keyWords")
	private List<Subject> subjects;
	
	/**
	 * Sets the id of the keyWord.
	 * @param id the id to set.
	 */
	public void setId(long id) {
		this.id = id;
	}
	
	/**
	 * Returns the id of the keyword.
	 * @return the id ot he keyword.
	 */
	public long getId() {
		return id;
	}
	
	/**
	 * Sets the word which represented the keyword.
	 * @param word the keyword to set.
	 */
	public void setWord(String word) {
		this.word = word;
	}
	
	/**
	 * Returns the word which represented the keyword.
	 * @return the word which represented the keyword.
	 */
	public String getWord() {
		return word;
	}

	/**
	 * Sets the list of {@link Subject} where the keyword is.
	 * @param subjects the list of {@link Subject} ,where the 
	 *        Keyword is, to set.
	 */
	public void setSubjects(List<Subject> subjects) {
		this.subjects = subjects;
	}

	/**
	 * Returns the list of {@link Subject} where the keyword is.
	 * @return the list of {@link Subject} where the keyword is.
	 */
	public List<Subject> getSubjects() {
		return subjects;
	}
}
